<style>
    .build-params .popover {
        max-width: 400px !important;
    }

    .projectName .popover {
        max-width: 400px !important;
    }

    .environmentVariables .popover {
        max-width: 400px !important;
    }

    .zoneType .popover {
        max-width: 500px !important;
    }

    .tomcatWebAppsPath .popover {
        max-width: 500px !important;
    }

    .httpStatus .popover {
        max-width: 500px !important;
    }
</style>
<div class="modal-header">
    <h3 class="modal-title">
        <b style="color: #286090">持续集成应用配置</b>
    </h3>
</div>
<div class="modal-body">

    <form class="bs-example form-horizontal">

        <div class="wrapper-md">
            <!-- toaster directive -->
            <toaster-container
                    toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>


            <!--<div style="font-size:1em;">&nbsp;</div>-->

            <div class="form-group">
                <div class="col-md-6">
                    <label class="col-lg-4 control-label"><span style="color: #ec2121;">*</span>应用名称
                    </label>
                    <div class="input-group" style="padding-left: 15px; padding-right: 15px">
                        <input type="text" class="form-control" placeholder="任务名称"
                               ng-model="appItem.appName">
                        <div class="input-group-btn">
                            <button class="btn btn-default"
                                    ng-click="checkJobName(jobItem.jobName)"><i
                                    class="glyphicon glyphicon-check pull-right"></i></button>
                        </div>
                    </div>
                </div>

            </div>

            <div class="form-group">
                <div class="col-md-6" ng-show="appItem.id == 0">
                    <label class="col-lg-4 control-label"><span style="color: #ec2121;">*</span>仓库项目名</label>
                    <div class="col-lg-8">
                        <ui-select ng-model="nowGitlabProject.selected" theme="bootstrap"
                                   ng-change="changeGitlabProject()">
                            <ui-select-match placeholder="搜索仓库项目名称......">{{$select.selected.name}}</ui-select-match>
                            <ui-select-choices refresh="queryGitlabProject($select.search)" refresh-dalay="0"
                                               repeat="item in gitlabProjectList | filter: $select.search">
                                <div ng-bind-html="item.name | highlight: $select.search"></div>
                            </ui-select-choices>
                        </ui-select>
                    </div>
                </div>

                <div class="col-md-6">
                    <label class="col-lg-4 control-label"><span style="color: #ec2121;">*</span>服务器组名称</label>
                    <div class="col-lg-8">
                        <ui-select ng-model="nowServerGroup.selected" theme="bootstrap"
                                   ng-change="changeServerGroup()">
                            <ui-select-match placeholder="搜索服务器组名称......">{{$select.selected.name}}</ui-select-match>
                            <ui-select-choices refresh="queryServerGroup($select.search)" refresh-dalay="0"
                                               repeat="item in serverGroupList | filter: $select.search">
                                <div ng-bind-html="item.name | highlight: $select.search"></div>
                            </ui-select-choices>
                        </ui-select>
                    </div>
                </div>
            </div>

            <div class="form-group build-params">
                <label class="col-lg-2 control-label">仓库地址</label>
                <div class="col-lg-10">
                    <input type="text" class="form-control" placeholder="仓库地址" readonly
                           ng-model="appItem.sshUrl">
                </div>
            </div>

            <div class="form-group build-params">
                <label class="col-lg-2 control-label">首页</label>
                <div class="col-lg-10">
                    <input type="text" class="form-control" placeholder="仓库地址" readonly
                           ng-model="appItem.webUrl">
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-6">
                    <label class="col-lg-4 control-label"><span style="color: #ec2121;">*</span>构建类型</label>
                    <div class="col-lg-8">
                        <!--required-->
                        <select class="form-control" ng-model="appItem.ciType"
                                ng-options="ci.code as ci.name for ci in ciType">
                            <option value="">--请选择--</option>
                        </select>
                    </div>
                </div>
                <div class="col-md-6">
                    <label class="col-lg-4 control-label"><span style="color: #ec2121;">*</span>应用类型</label>
                    <div class="col-lg-8">
                        <!--required-->
                        <select class="form-control" ng-model="appItem.appType"
                                ng-options="app.code as app.name for app in appType">
                            <option value="">--请选择--</option>
                        </select>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-6">
                    <label class="col-lg-4 control-label">分支权限</label>
                    <div class="col-lg-8">
                        <label style="margin-top:5px;">
                            <input type="checkbox" ng-model="appItem.authBranch"><b style="color: #2b669a;margin-left: 5px">启用分支权限控制</b>
                        </label>
                    </div>
                </div>

                <!--ng-options="dingtalk.id as dingtalk.name for dingtalk in appItem.dingtalkList"-->
                <div class="col-md-6" ng-show="appItem.id != 0">
                    <label class="col-lg-4 control-label">Dingtalk</label>
                    <div class="col-lg-8">
                        <select class="form-control" ng-model="nowDingtalk.selected"
                                ng-options="dingtalk as dingtalk.name for dingtalk in appItem.dingtalkList">
                            <option value="">--请选择--</option>
                        </select>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-lg-2 control-label">说明</label>
                <div class="col-lg-10">
                            <textarea class="form-control" cols="3" placeholder="简短描述"
                                      ng-model="appItem.content"></textarea>
                </div>
            </div>

            <div class="form-group">
                <div style="text-align:center;">
                    <div style="text-align:center;">

                        <button ng-click="saveApp()"
                                class="btn btn-xs"
                                style="margin-left: 5px; background-color: #2e6da4; color: white;">
                            <span class="glyphicon glyphicon-ok"></span>保存
                        </button>

                        <!--<button ng-click="resetJob()"-->
                        <!--class="btn btn-xs"-->
                        <!--style="margin-left: 5px; background-color: #449d44; color: white;">-->
                        <!--<span class="glyphicon glyphicon-repeat"></span>重置-->
                        <!--</button>-->
                    </div>
                    <!--<span class="glyphicon glyphicon-save" ng-click="saveServerItem(insideip, publicip)"></span>-->
                    <!--<span class="glyphicon glyphicon-repeat" style="margin-left: 20px;" ng-click="resetServerItem()"></span>-->
                </div>
            </div>

            <div style="font-size:1em;">&nbsp;</div>
            <div class="form-group">
                <div style="text-align:center;" ng-show="todoDetail.todoStatus <= 0">
                    <!--保存-->
                    <button ng-click="saveTodo()"
                            class="btn btn-xs"
                            style="margin-left: 5px; background-color: #2e6da4; color: white;">
                        <span class="glyphicon glyphicon-ok"></span>保存
                    </button>
                </div>
            </div>

        </div>
    </form>

    <div ng-if="alert.type != ''">
        <div uib-alert ng-class="'alert-' + alert.type" close="closeAlert()">{{alert.msg}}</div>
    </div>
</div>